package com.example.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.Orderform;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author tyhxzy
 * @since 2023-11-03
 */
public interface OrderformMapper extends BaseMapper<Orderform> {
    //商户查看油气订单全部
    List<Map> findOrderformByStatus(@Param("id") Integer id,@Param("status") Integer status);
    //状态查
    Map findOrderformStatusById(Integer id);
    //消费者查看我的油气订单全部
    List<Map> findOrderformByName(@Param("id") Integer id,@Param("status") Integer status);

    //状态查
    Map findOrderformNameById(Integer id);

    //
    @Select("SELECT COUNT(id) FROM orderform WHERE zid=#{id}")
    int findSum(Integer id);
    @Select("SELECT SUM(price) FROM orderform WHERE zid=#{id}")
    Double findPrice(Integer id);

    @Select("select * from orderform where writercodr=#{writercodr}")
    Orderform findOrderformwritercodr(String writercodr);



    @Update("update orderform set status=16 where zid=#{zid}" )
    int updateWritercodrInt(Integer zid);
}
